﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using IterationLife.Extensions.Dtos;
using IterationLife.FootballTeaching.Enums;
using Util.Applications;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.FootballTeachings
{
    /// <summary>
    /// 课时数据传输对象
    /// </summary>
    [DataContract]
    public class LessonDto : DtoBase
    {
        /// <summary>
        /// 初始化课时数据传输对象
        /// </summary>
        public LessonDto()
        {
            Banner = new Resources();
            Video = new Resources();
        }

        /// <summary>
        /// 章节编号
        /// </summary>
        [Required(ErrorMessage = "章节编号不能为空")]
        [Display(Name = "章节编号")]
        [DataMember]
        public Guid? ChapterId { get; set; }

        /// <summary>
        /// 章节名称
        /// </summary>
        public string ChapterName { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [Required(ErrorMessage = "名称不能为空")]
        [StringLength(50, ErrorMessage = "名称输入过长，不能超过50位")]
        [Display(Name = "名称")]
        [DataMember]
        public string Name { get; set; }

        /// <summary>
        /// 封面图
        /// </summary>
        [Required(ErrorMessage = "封面图不能为空")]
        [Display(Name = "封面图")]
        [DataMember]
        public Resources Banner { get; set; }

        /// <summary>
        /// 视频
        /// </summary>
        [Required(ErrorMessage = "视频不能为空")]
        [Display(Name = "视频")]
        [DataMember]
        public Resources Video { get; set; }

        /// <summary>
        /// 难度
        /// </summary>
        [Required(ErrorMessage = "难度不能为空")]
        [Display(Name = "难度")]
        [DataMember]
        public DifficultyType? Difficulty { get; set; }

        /// <summary>
        /// 要求
        /// </summary>
        [Required(ErrorMessage = "要求不能为空")]
        [StringLength(255, ErrorMessage = "要求输入过长，不能超过255位")]
        [Display(Name = "要求")]
        [DataMember]
        public string Requirement { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [Required(ErrorMessage = "内容不能为空")]
        [Display(Name = "内容")]
        [DataMember]
        public string Content { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        [Required(ErrorMessage = "排序号不能为空")]
        [Display(Name = "课时数")]
        [DataMember]
        public int? SortId { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        [DataMember]
        public DateTime? CreationTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        [DataMember]
        public Guid? CreatorId { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        [Display(Name = "最后修改时间")]
        [DataMember]
        public DateTime? LastModificationTime { get; set; }

        /// <summary>
        /// 最后修改人
        /// </summary>
        [Display(Name = "最后修改人")]
        [DataMember]
        public Guid? LastModifierId { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [Required(ErrorMessage = "是否删除不能为空")]
        [Display(Name = "是否删除")]
        [DataMember]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        [Display(Name = "版本号")]
        [DataMember]
        public Byte[] Version { get; set; }

        /// <summary>
        /// 输出课时状态
        /// </summary>
        public override string ToString()
        {
            return this.ToEntity().ToString();
        }
    }
}
